
#metadef
#idString Electronic Load, XY-FZ35
#name Electronic Load XY-FZ35
#handle FZ35
#replaceText MaxCurrent 5.0
#replaceText MaxLimitCurrent 5.1
#replaceText MaxPower 35.5

#metadef
#replaceText MaxCurrent 4.0
#replaceText MaxLimitCurrent 4.1
#replaceText MaxPower 25.5

#meta
#idString Electronic Load, XY-FZ25
#name Electronic Load XY-FZ25
#handle FZ25
#port comfixedbaud
#driver Ascii
#baudrate 9600

#value Voltage V D2
#value Current A D2
#value Capacity Ah D3
#value Time min D0

;00.00V,0.00A,0.700Ah,01:10
#rxMask ^[0-9][0-9]\.[0-9][0-9]V,[0-9]\.[0-9][0-9]A,[0-9]\.[0-9][0-9][0-9]Ah,[0-9][0-9]:[0-9][0-9]
#askValues values?
#askValuesReadFormat uuuh


#noteImages https://lygte-info.dk/pic/Projects/Electronic%20Load%20XY-FZ25/DSC_3819.jpg https://lygte-info.dk/pic/Projects/Electronic%20Load%20XY-FZ25/DSC_3837.jpg

#eol \0

#scpiCmd on txrx (value?"on":"off")
#scpiCmd current txrx (formatDouble(value,1,1,2,2)+"A")
#scpiCmd maxPower txrx OPP:(formatDouble(value,2,2,2,2))
#scpiCmd maxVoltage txrx OVP:(formatDouble(value,2,2,1,1))
#scpiCmd maxCurrent txrx OCP:(formatDouble(value,1,1,2,2))
#scpiCmd minVoltage txrx LVP:(formatDouble(value,2,2,1,1))
#scpiCmd maxCapacity txrx OAH:(formatDouble(value,1,1,3,3))

#readingDelay 2

;OVP:25.2, OCP:4.10, OPP:25.50, LVP:01.5,OAH:0.000,OHP:00:00
#scpiCmd maxPower? txrx? read
:readmath: getMatchGroup(value,"OPP:([0-9.]+)",1)
#scpiCmd maxVoltage? txrx? read
:readmath: getMatchGroup(value,"OVP:([0-9.]+)",1)
#scpiCmd maxCurrent? txrx? read
:readmath: getMatchGroup(value,"OCP:([0-9.]+)",1)
#scpiCmd minVoltage? txrx? read
:readmath: getMatchGroup(value,"LVP:([0-9.]+)",1)
#scpiCmd maxCapacity? txrx? read
:readmath: getMatchGroup(value,"OAH:([0-9.]+)",1)


#scpiCmd isFZ? txrx? read
:readmath: match(value,".*OAH:.*")

#verifyDevice 1 isFZ?

#prepareSample tx start

#finalCmd tx stop

#outputOff on 0


; This type will specify the handle name for the first device with this type
; This makes it possible to easy get generic handle names for a setup, that will work with a script
#interfaceType Load
; These function will adjust settings
#interface setCurrent current (value)
#interface setMinVoltage minVoltage (value)
#interface getMinVoltage minVoltage?
#interface setOn on (value)
#interface readVoltage 0
#interface readCurrent 1
#interface readCapacity 2


#cmdSetup radio Current
:write: current 
:tip: Load current for current mode
100mA 0.1
300mA 0.3
1A 1.0
3A 3.0


#cmdSetup number Current
:write: current 
Amps 0 MaxCurrent


#cmdSetup number Max_current 
:write: maxCurrent 
:read: maxCurrent?
A 0 MaxLimitCurrent

#cmdSetup number Max_voltage
:write: maxVoltage
:read: maxVoltage?
V 0 25.2

#cmdSetup number Max_power
:write: maxPower
:read: maxPower?
W 0 MaxPower

#cmdSetup number Max_capacity
:write: maxCapacity
:read: maxCapacity?
:tip: Use 0 to disable
Ah 0 9.999

#cmdSetup number Min_voltage
:write: minVoltage
:read: minVoltage?
V 1.5 25.2

#cmdsetup buttons Status
:write: on
off 0
on 1
